package planit.controller;

import java.util.HashMap;
import java.util.Map;

import javax.swing.Action;

import planit.model.Model;

public final class ControllerFactory {
	public enum ControllerType {
		// Create: 
		CREATE_EVENT,
		CREATE_PERSON,
		CREATE_GROUP,
		CREATE_EVENTTYPE,
		// Modify:
		EDIT_EVENT,
		EDIT_PERSON,
		EDIT_GROUP,
		EDIT_EVENTTYPE,
		// Delete:
		DELETE_EVENT,
		DELETE_PERSON,
		DELETE_GROUP,
		DELETE_EVENTTYPE,
		// Bind:
		ADD_PERSON_TO_EVENT,
		ADD_PERSON_TO_GROUP,
		REMOVE_PERSON_FROM_EVENT,
		REMOVE_PERSON_FROM_GROUP,
		// Data:
		COMMIT_CHANGES,
		CHECKOUT
	}

	private static Map<ControllerType, Action> controllers = 
		new HashMap<ControllerType, Action>();

	private static Model model;

	public static Action getController(ControllerType type) {
		return controllers.get(type);
	}

	public static void setModel(Model mdl) {
		model = mdl;
	}

	public static void seedController(ControllerType type, Action action) {
		controllers.put(type, action);
	}
}

